/**
 * Created by chenxiaozhong on 2016年1月5日16:51:26.
 */
define(["app",
    "controllers/conference/EditDauthorityController"
], function (app) {

    var deps = ["$modal","$window","$state"];

    function editDauthority($modal,$window,$state,chooseUser) {
        return {
            scope : {
            	chooseUser : "@",
            	chooseUserName : "@",
            	companyCode : "@"
            },
            link: function ($scope, elem) {
                elem.on("click", function () {
                    var modalInstance = $modal.open({
                        templateUrl: 'views/conference/EditDauthority.html',
                        controller: "EditDauthorityController",
                        backdrop : "static",
                        keyboard: false,
                        resolve : {
                        	chooseUser : function() {
                                return $scope.chooseUser;
                            },
                            chooseUserName : function() {
                                return $scope.chooseUserName;
                            },
                            companyCode : function() {
                                return $scope.companyCode;
                            }
                        },
                        windowClass : "conpany-add-modal"
                    });

                    modalInstance.result.then(function(data) {
                    	if(data==null ||'undefined'==data){
                    		return;
                    	}else{
                    		$scope.$emit('dAuthorityEditBroadCast');
                    	}
                    	
                    });
                });
                
            }
        };
    }

    editDauthority.$inject = deps;
    return app.lazy.directive("fcEditDauthority", editDauthority);
});